package com.deep.ware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.deep.common.model.dto.OrderDTO;
import com.deep.common.model.dto.SkuHasStockTO;
import com.deep.common.utils.PageUtils;
import com.deep.ware.model.dto.WareSkuLockDTO;
import com.deep.ware.model.entity.WareSkuEntity;
import com.deep.ware.model.vo.WareSkuEntityVO;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author deep
 * @email ${email}
 * @date 2022-01-13 17:24:59
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 商品库存检索
     *
     * @param params
     * @return
     */
    PageUtils queryDetail(Map<String, Object> params);

    /**
     * 新增库存
     *
     * @param wareSkuVO
     */
    void saveDetail(WareSkuEntityVO wareSkuVO);

    BigDecimal addStock(Long skuId, Long wareId, Integer skuNum);

    List<SkuHasStockTO> getSkusHasStock(List<Long> skuIds);

    boolean lockStock(WareSkuLockDTO lockDTO);

    int unLockStock(Long skuId, Long wareId, Integer num);

    int unlockStock(OrderDTO orderDTO);
}

